package com.lj.dict.param;

import com.lj.dict.entity.Dict;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import com.lj.dict.enums.DictStatus;
import com.lj.common.utils.EnumUtils;

/**
 * <p>
 * 字典表 保存参数
 * </p>
 *
 * @author luojing
 * @since 2025-01-10 11:07:47
 */
@Data
@Schema(description = "字典表 保存参数")
public class DictSaveParam {

    @Schema(description = "字典名称")
    private String dictName;

    @Schema(description = "字典类型")
    private String dictType;

    @Schema(description = "字典状态 参考字典: DictStatus")
    private Integer dictStatus;

    @Schema(description = "字典描述")
    private String remark;

    public Dict toEntity() {
        Dict entity = new Dict();
        entity.setDictName(dictName);
        entity.setDictType(dictType);
        entity.setDictStatus(EnumUtils.getByValue(DictStatus.class, dictStatus));
        entity.setRemark(remark);
        return entity;
    }
}
